<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - coverage_clean.info - usr/include/x86_64-linux-gnu/c++/13/bits/gthr-default.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../../../gcov.css">
</head>

<body>

          <table width="100%" border=0 cellspacing=0 cellpadding=0>
            <tr><td class="title">LCOV - code coverage report</td></tr>
            <tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>

            <tr>
              <td width="100%">
                <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="10%" class="headerValue"><a href="../../../../../../index.html">top level</a> - <a href="index.html">/usr/include/x86_64-linux-gnu/c++/13/bits</a> - gthr-default.h<span style="font-size: 80%;"> (source / <a href="gthr-default.h.func-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="5%"></td>
            <td width="5%" class="headerCovTableHead">Coverage</td>
            <td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
            <td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">coverage_clean.info</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntryMed">80.0&nbsp;%</td>
            <td class="headerCovTableEntry">10</td>
            <td class="headerCovTableEntry">8</td>
          </tr>
          <tr>
            <td class="headerItem">Test Date:</td>
            <td class="headerValue">2025-11-25 04:45:29</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntryHi">100.0&nbsp;%</td>
            <td class="headerCovTableEntry">3</td>
            <td class="headerCovTableEntry">3</td>
          </tr>
                  <tr><td><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
                </table>
              </td>
            </tr>

            <tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
          </table>

          <table cellpadding=0 cellspacing=0 border=0>
            <tr>
              <td><br></td>
            </tr>
            <tr>
              <td>
<pre class="sourceHeading">            Line data    Source code</pre>
<pre class="source">
<span id="L1"><span class="lineNum">       1</span>              : /* Threads compatibility routines for libgcc2 and libobjc.  */</span>
<span id="L2"><span class="lineNum">       2</span>              : /* Compile this one with gcc.  */</span>
<span id="L3"><span class="lineNum">       3</span>              : /* Copyright (C) 1997-2023 Free Software Foundation, Inc.</span>
<span id="L4"><span class="lineNum">       4</span>              : </span>
<span id="L5"><span class="lineNum">       5</span>              : This file is part of GCC.</span>
<span id="L6"><span class="lineNum">       6</span>              : </span>
<span id="L7"><span class="lineNum">       7</span>              : GCC is free software; you can redistribute it and/or modify it under</span>
<span id="L8"><span class="lineNum">       8</span>              : the terms of the GNU General Public License as published by the Free</span>
<span id="L9"><span class="lineNum">       9</span>              : Software Foundation; either version 3, or (at your option) any later</span>
<span id="L10"><span class="lineNum">      10</span>              : version.</span>
<span id="L11"><span class="lineNum">      11</span>              : </span>
<span id="L12"><span class="lineNum">      12</span>              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY</span>
<span id="L13"><span class="lineNum">      13</span>              : WARRANTY; without even the implied warranty of MERCHANTABILITY or</span>
<span id="L14"><span class="lineNum">      14</span>              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License</span>
<span id="L15"><span class="lineNum">      15</span>              : for more details.</span>
<span id="L16"><span class="lineNum">      16</span>              : </span>
<span id="L17"><span class="lineNum">      17</span>              : Under Section 7 of GPL version 3, you are granted additional</span>
<span id="L18"><span class="lineNum">      18</span>              : permissions described in the GCC Runtime Library Exception, version</span>
<span id="L19"><span class="lineNum">      19</span>              : 3.1, as published by the Free Software Foundation.</span>
<span id="L20"><span class="lineNum">      20</span>              : </span>
<span id="L21"><span class="lineNum">      21</span>              : You should have received a copy of the GNU General Public License and</span>
<span id="L22"><span class="lineNum">      22</span>              : a copy of the GCC Runtime Library Exception along with this program;</span>
<span id="L23"><span class="lineNum">      23</span>              : see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see</span>
<span id="L24"><span class="lineNum">      24</span>              : &lt;http://www.gnu.org/licenses/&gt;.  */</span>
<span id="L25"><span class="lineNum">      25</span>              : </span>
<span id="L26"><span class="lineNum">      26</span>              : #ifndef _GLIBCXX_GCC_GTHR_POSIX_H</span>
<span id="L27"><span class="lineNum">      27</span>              : #define _GLIBCXX_GCC_GTHR_POSIX_H</span>
<span id="L28"><span class="lineNum">      28</span>              : </span>
<span id="L29"><span class="lineNum">      29</span>              : /* POSIX threads specific definitions.</span>
<span id="L30"><span class="lineNum">      30</span>              :    Easy, since the interface is just one-to-one mapping.  */</span>
<span id="L31"><span class="lineNum">      31</span>              : </span>
<span id="L32"><span class="lineNum">      32</span>              : #define __GTHREADS 1</span>
<span id="L33"><span class="lineNum">      33</span>              : #define __GTHREADS_CXX0X 1</span>
<span id="L34"><span class="lineNum">      34</span>              : </span>
<span id="L35"><span class="lineNum">      35</span>              : #include &lt;pthread.h&gt;</span>
<span id="L36"><span class="lineNum">      36</span>              : </span>
<span id="L37"><span class="lineNum">      37</span>              : #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \</span>
<span id="L38"><span class="lineNum">      38</span>              :      || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))</span>
<span id="L39"><span class="lineNum">      39</span>              : # include &lt;unistd.h&gt;</span>
<span id="L40"><span class="lineNum">      40</span>              : # if defined(_POSIX_TIMEOUTS) &amp;&amp; _POSIX_TIMEOUTS &gt;= 0</span>
<span id="L41"><span class="lineNum">      41</span>              : #  define _GTHREAD_USE_MUTEX_TIMEDLOCK 1</span>
<span id="L42"><span class="lineNum">      42</span>              : # else</span>
<span id="L43"><span class="lineNum">      43</span>              : #  define _GTHREAD_USE_MUTEX_TIMEDLOCK 0</span>
<span id="L44"><span class="lineNum">      44</span>              : # endif</span>
<span id="L45"><span class="lineNum">      45</span>              : #endif</span>
<span id="L46"><span class="lineNum">      46</span>              : </span>
<span id="L47"><span class="lineNum">      47</span>              : typedef pthread_t __gthread_t;</span>
<span id="L48"><span class="lineNum">      48</span>              : typedef pthread_key_t __gthread_key_t;</span>
<span id="L49"><span class="lineNum">      49</span>              : typedef pthread_once_t __gthread_once_t;</span>
<span id="L50"><span class="lineNum">      50</span>              : typedef pthread_mutex_t __gthread_mutex_t;</span>
<span id="L51"><span class="lineNum">      51</span>              : typedef pthread_mutex_t __gthread_recursive_mutex_t;</span>
<span id="L52"><span class="lineNum">      52</span>              : typedef pthread_cond_t __gthread_cond_t;</span>
<span id="L53"><span class="lineNum">      53</span>              : typedef struct timespec __gthread_time_t;</span>
<span id="L54"><span class="lineNum">      54</span>              : </span>
<span id="L55"><span class="lineNum">      55</span>              : /* POSIX like conditional variables are supported.  Please look at comments</span>
<span id="L56"><span class="lineNum">      56</span>              :    in gthr.h for details. */</span>
<span id="L57"><span class="lineNum">      57</span>              : #define __GTHREAD_HAS_COND      1</span>
<span id="L58"><span class="lineNum">      58</span>              : </span>
<span id="L59"><span class="lineNum">      59</span>              : #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER</span>
<span id="L60"><span class="lineNum">      60</span>              : #define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function</span>
<span id="L61"><span class="lineNum">      61</span>              : #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT</span>
<span id="L62"><span class="lineNum">      62</span>              : #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)</span>
<span id="L63"><span class="lineNum">      63</span>              : #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER</span>
<span id="L64"><span class="lineNum">      64</span>              : #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)</span>
<span id="L65"><span class="lineNum">      65</span>              : #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP</span>
<span id="L66"><span class="lineNum">      66</span>              : #else</span>
<span id="L67"><span class="lineNum">      67</span>              : #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function</span>
<span id="L68"><span class="lineNum">      68</span>              : #endif</span>
<span id="L69"><span class="lineNum">      69</span>              : #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER</span>
<span id="L70"><span class="lineNum">      70</span>              : #define __GTHREAD_TIME_INIT {0,0}</span>
<span id="L71"><span class="lineNum">      71</span>              : </span>
<span id="L72"><span class="lineNum">      72</span>              : #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC</span>
<span id="L73"><span class="lineNum">      73</span>              : # undef __GTHREAD_MUTEX_INIT</span>
<span id="L74"><span class="lineNum">      74</span>              : #endif</span>
<span id="L75"><span class="lineNum">      75</span>              : #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC</span>
<span id="L76"><span class="lineNum">      76</span>              : # undef __GTHREAD_RECURSIVE_MUTEX_INIT</span>
<span id="L77"><span class="lineNum">      77</span>              : # undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION</span>
<span id="L78"><span class="lineNum">      78</span>              : # define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function</span>
<span id="L79"><span class="lineNum">      79</span>              : #endif</span>
<span id="L80"><span class="lineNum">      80</span>              : #ifdef _GTHREAD_USE_COND_INIT_FUNC</span>
<span id="L81"><span class="lineNum">      81</span>              : # undef __GTHREAD_COND_INIT</span>
<span id="L82"><span class="lineNum">      82</span>              : # define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function</span>
<span id="L83"><span class="lineNum">      83</span>              : #endif</span>
<span id="L84"><span class="lineNum">      84</span>              : </span>
<span id="L85"><span class="lineNum">      85</span>              : #if __GXX_WEAK__ &amp;&amp; _GLIBCXX_GTHREAD_USE_WEAK</span>
<span id="L86"><span class="lineNum">      86</span>              : # ifndef __gthrw_pragma</span>
<span id="L87"><span class="lineNum">      87</span>              : #  define __gthrw_pragma(pragma)</span>
<span id="L88"><span class="lineNum">      88</span>              : # endif</span>
<span id="L89"><span class="lineNum">      89</span>              : # define __gthrw2(name,name2,type) \</span>
<span id="L90"><span class="lineNum">      90</span>              :   static __typeof(type) name \</span>
<span id="L91"><span class="lineNum">      91</span>              :     __attribute__ ((__weakref__(#name2), __copy__ (type))); \</span>
<span id="L92"><span class="lineNum">      92</span>              :   __gthrw_pragma(weak type)</span>
<span id="L93"><span class="lineNum">      93</span>              : # define __gthrw_(name) __gthrw_ ## name</span>
<span id="L94"><span class="lineNum">      94</span>              : #else</span>
<span id="L95"><span class="lineNum">      95</span>              : # define __gthrw2(name,name2,type)</span>
<span id="L96"><span class="lineNum">      96</span>              : # define __gthrw_(name) name</span>
<span id="L97"><span class="lineNum">      97</span>              : #endif</span>
<span id="L98"><span class="lineNum">      98</span>              : </span>
<span id="L99"><span class="lineNum">      99</span>              : /* Typically, __gthrw_foo is a weak reference to symbol foo.  */</span>
<span id="L100"><span class="lineNum">     100</span>              : #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)</span>
<span id="L101"><span class="lineNum">     101</span>              : </span>
<span id="L102"><span class="lineNum">     102</span>              : __gthrw(pthread_once)</span>
<span id="L103"><span class="lineNum">     103</span>              : __gthrw(pthread_getspecific)</span>
<span id="L104"><span class="lineNum">     104</span>              : __gthrw(pthread_setspecific)</span>
<span id="L105"><span class="lineNum">     105</span>              : </span>
<span id="L106"><span class="lineNum">     106</span>              : __gthrw(pthread_create)</span>
<span id="L107"><span class="lineNum">     107</span>              : __gthrw(pthread_join)</span>
<span id="L108"><span class="lineNum">     108</span>              : __gthrw(pthread_equal)</span>
<span id="L109"><span class="lineNum">     109</span>              : __gthrw(pthread_self)</span>
<span id="L110"><span class="lineNum">     110</span>              : __gthrw(pthread_detach)</span>
<span id="L111"><span class="lineNum">     111</span>              : #ifndef __BIONIC__</span>
<span id="L112"><span class="lineNum">     112</span>              : __gthrw(pthread_cancel)</span>
<span id="L113"><span class="lineNum">     113</span>              : #endif</span>
<span id="L114"><span class="lineNum">     114</span>              : __gthrw(sched_yield)</span>
<span id="L115"><span class="lineNum">     115</span>              : </span>
<span id="L116"><span class="lineNum">     116</span>              : __gthrw(pthread_mutex_lock)</span>
<span id="L117"><span class="lineNum">     117</span>              : __gthrw(pthread_mutex_trylock)</span>
<span id="L118"><span class="lineNum">     118</span>              : #if _GTHREAD_USE_MUTEX_TIMEDLOCK</span>
<span id="L119"><span class="lineNum">     119</span>              : __gthrw(pthread_mutex_timedlock)</span>
<span id="L120"><span class="lineNum">     120</span>              : #endif</span>
<span id="L121"><span class="lineNum">     121</span>              : __gthrw(pthread_mutex_unlock)</span>
<span id="L122"><span class="lineNum">     122</span>              : __gthrw(pthread_mutex_init)</span>
<span id="L123"><span class="lineNum">     123</span>              : __gthrw(pthread_mutex_destroy)</span>
<span id="L124"><span class="lineNum">     124</span>              : </span>
<span id="L125"><span class="lineNum">     125</span>              : __gthrw(pthread_cond_init)</span>
<span id="L126"><span class="lineNum">     126</span>              : __gthrw(pthread_cond_broadcast)</span>
<span id="L127"><span class="lineNum">     127</span>              : __gthrw(pthread_cond_signal)</span>
<span id="L128"><span class="lineNum">     128</span>              : __gthrw(pthread_cond_wait)</span>
<span id="L129"><span class="lineNum">     129</span>              : __gthrw(pthread_cond_timedwait)</span>
<span id="L130"><span class="lineNum">     130</span>              : __gthrw(pthread_cond_destroy)</span>
<span id="L131"><span class="lineNum">     131</span>              : </span>
<span id="L132"><span class="lineNum">     132</span>              : __gthrw(pthread_key_create)</span>
<span id="L133"><span class="lineNum">     133</span>              : __gthrw(pthread_key_delete)</span>
<span id="L134"><span class="lineNum">     134</span>              : __gthrw(pthread_mutexattr_init)</span>
<span id="L135"><span class="lineNum">     135</span>              : __gthrw(pthread_mutexattr_settype)</span>
<span id="L136"><span class="lineNum">     136</span>              : __gthrw(pthread_mutexattr_destroy)</span>
<span id="L137"><span class="lineNum">     137</span>              : </span>
<span id="L138"><span class="lineNum">     138</span>              : </span>
<span id="L139"><span class="lineNum">     139</span>              : #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)</span>
<span id="L140"><span class="lineNum">     140</span>              : /* Objective-C.  */</span>
<span id="L141"><span class="lineNum">     141</span>              : __gthrw(pthread_exit)</span>
<span id="L142"><span class="lineNum">     142</span>              : #ifdef _POSIX_PRIORITY_SCHEDULING</span>
<span id="L143"><span class="lineNum">     143</span>              : #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING</span>
<span id="L144"><span class="lineNum">     144</span>              : __gthrw(sched_get_priority_max)</span>
<span id="L145"><span class="lineNum">     145</span>              : __gthrw(sched_get_priority_min)</span>
<span id="L146"><span class="lineNum">     146</span>              : #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */</span>
<span id="L147"><span class="lineNum">     147</span>              : #endif /* _POSIX_PRIORITY_SCHEDULING */</span>
<span id="L148"><span class="lineNum">     148</span>              : __gthrw(pthread_attr_destroy)</span>
<span id="L149"><span class="lineNum">     149</span>              : __gthrw(pthread_attr_init)</span>
<span id="L150"><span class="lineNum">     150</span>              : __gthrw(pthread_attr_setdetachstate)</span>
<span id="L151"><span class="lineNum">     151</span>              : #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING</span>
<span id="L152"><span class="lineNum">     152</span>              : __gthrw(pthread_getschedparam)</span>
<span id="L153"><span class="lineNum">     153</span>              : __gthrw(pthread_setschedparam)</span>
<span id="L154"><span class="lineNum">     154</span>              : #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */</span>
<span id="L155"><span class="lineNum">     155</span>              : #endif /* _LIBOBJC || _LIBOBJC_WEAK */</span>
<span id="L156"><span class="lineNum">     156</span>              : </span>
<span id="L157"><span class="lineNum">     157</span>              : #if __GXX_WEAK__ &amp;&amp; _GLIBCXX_GTHREAD_USE_WEAK</span>
<span id="L158"><span class="lineNum">     158</span>              : </span>
<span id="L159"><span class="lineNum">     159</span>              : /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if</span>
<span id="L160"><span class="lineNum">     160</span>              :    -pthreads is not specified.  The functions are dummies and most return an</span>
<span id="L161"><span class="lineNum">     161</span>              :    error value.  However pthread_once returns 0 without invoking the routine</span>
<span id="L162"><span class="lineNum">     162</span>              :    it is passed so we cannot pretend that the interface is active if -pthreads</span>
<span id="L163"><span class="lineNum">     163</span>              :    is not specified.  On Solaris 2.5.1, the interface is not exposed at all so</span>
<span id="L164"><span class="lineNum">     164</span>              :    we need to play the usual game with weak symbols.  On Solaris 10 and up, a</span>
<span id="L165"><span class="lineNum">     165</span>              :    working interface is always exposed.  On FreeBSD 6 and later, libc also</span>
<span id="L166"><span class="lineNum">     166</span>              :    exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up</span>
<span id="L167"><span class="lineNum">     167</span>              :    to 9 does.  FreeBSD &gt;= 700014 even provides a pthread_cancel stub in libc,</span>
<span id="L168"><span class="lineNum">     168</span>              :    which means the alternate __gthread_active_p below cannot be used there.  */</span>
<span id="L169"><span class="lineNum">     169</span>              : </span>
<span id="L170"><span class="lineNum">     170</span>              : #if defined(__FreeBSD__) || (defined(__sun) &amp;&amp; defined(__svr4__))</span>
<span id="L171"><span class="lineNum">     171</span>              : </span>
<span id="L172"><span class="lineNum">     172</span>              : static volatile int __gthread_active = -1;</span>
<span id="L173"><span class="lineNum">     173</span>              : </span>
<span id="L174"><span class="lineNum">     174</span>              : static void</span>
<span id="L175"><span class="lineNum">     175</span>              : __gthread_trigger (void)</span>
<span id="L176"><span class="lineNum">     176</span>              : {</span>
<span id="L177"><span class="lineNum">     177</span>              :   __gthread_active = 1;</span>
<span id="L178"><span class="lineNum">     178</span>              : }</span>
<span id="L179"><span class="lineNum">     179</span>              : </span>
<span id="L180"><span class="lineNum">     180</span>              : static inline int</span>
<span id="L181"><span class="lineNum">     181</span>              : __gthread_active_p (void)</span>
<span id="L182"><span class="lineNum">     182</span>              : {</span>
<span id="L183"><span class="lineNum">     183</span>              :   static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;</span>
<span id="L184"><span class="lineNum">     184</span>              :   static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;</span>
<span id="L185"><span class="lineNum">     185</span>              : </span>
<span id="L186"><span class="lineNum">     186</span>              :   /* Avoid reading __gthread_active twice on the main code path.  */</span>
<span id="L187"><span class="lineNum">     187</span>              :   int __gthread_active_latest_value = __gthread_active;</span>
<span id="L188"><span class="lineNum">     188</span>              : </span>
<span id="L189"><span class="lineNum">     189</span>              :   /* This test is not protected to avoid taking a lock on the main code</span>
<span id="L190"><span class="lineNum">     190</span>              :      path so every update of __gthread_active in a threaded program must</span>
<span id="L191"><span class="lineNum">     191</span>              :      be atomic with regard to the result of the test.  */</span>
<span id="L192"><span class="lineNum">     192</span>              :   if (__builtin_expect (__gthread_active_latest_value &lt; 0, 0))</span>
<span id="L193"><span class="lineNum">     193</span>              :     {</span>
<span id="L194"><span class="lineNum">     194</span>              :       if (__gthrw_(pthread_once))</span>
<span id="L195"><span class="lineNum">     195</span>              :         {</span>
<span id="L196"><span class="lineNum">     196</span>              :           /* If this really is a threaded program, then we must ensure that</span>
<span id="L197"><span class="lineNum">     197</span>              :              __gthread_active has been set to 1 before exiting this block.  */</span>
<span id="L198"><span class="lineNum">     198</span>              :           __gthrw_(pthread_mutex_lock) (&amp;__gthread_active_mutex);</span>
<span id="L199"><span class="lineNum">     199</span>              :           __gthrw_(pthread_once) (&amp;__gthread_active_once, __gthread_trigger);</span>
<span id="L200"><span class="lineNum">     200</span>              :           __gthrw_(pthread_mutex_unlock) (&amp;__gthread_active_mutex);</span>
<span id="L201"><span class="lineNum">     201</span>              :         }</span>
<span id="L202"><span class="lineNum">     202</span>              : </span>
<span id="L203"><span class="lineNum">     203</span>              :       /* Make sure we'll never enter this block again.  */</span>
<span id="L204"><span class="lineNum">     204</span>              :       if (__gthread_active &lt; 0)</span>
<span id="L205"><span class="lineNum">     205</span>              :         __gthread_active = 0;</span>
<span id="L206"><span class="lineNum">     206</span>              : </span>
<span id="L207"><span class="lineNum">     207</span>              :       __gthread_active_latest_value = __gthread_active;</span>
<span id="L208"><span class="lineNum">     208</span>              :     }</span>
<span id="L209"><span class="lineNum">     209</span>              : </span>
<span id="L210"><span class="lineNum">     210</span>              :   return __gthread_active_latest_value != 0;</span>
<span id="L211"><span class="lineNum">     211</span>              : }</span>
<span id="L212"><span class="lineNum">     212</span>              : </span>
<span id="L213"><span class="lineNum">     213</span>              : #else /* neither FreeBSD nor Solaris */</span>
<span id="L214"><span class="lineNum">     214</span>              : </span>
<span id="L215"><span class="lineNum">     215</span>              : /* For a program to be multi-threaded the only thing that it certainly must</span>
<span id="L216"><span class="lineNum">     216</span>              :    be using is pthread_create.  However, there may be other libraries that</span>
<span id="L217"><span class="lineNum">     217</span>              :    intercept pthread_create with their own definitions to wrap pthreads</span>
<span id="L218"><span class="lineNum">     218</span>              :    functionality for some purpose.  In those cases, pthread_create being</span>
<span id="L219"><span class="lineNum">     219</span>              :    defined might not necessarily mean that libpthread is actually linked</span>
<span id="L220"><span class="lineNum">     220</span>              :    in.</span>
<span id="L221"><span class="lineNum">     221</span>              : </span>
<span id="L222"><span class="lineNum">     222</span>              :    For the GNU C library, we can use a known internal name.  This is always</span>
<span id="L223"><span class="lineNum">     223</span>              :    available in the ABI, but no other library would define it.  That is</span>
<span id="L224"><span class="lineNum">     224</span>              :    ideal, since any public pthread function might be intercepted just as</span>
<span id="L225"><span class="lineNum">     225</span>              :    pthread_create might be.  __pthread_key_create is an &quot;internal&quot;</span>
<span id="L226"><span class="lineNum">     226</span>              :    implementation symbol, but it is part of the public exported ABI.  Also,</span>
<span id="L227"><span class="lineNum">     227</span>              :    it's among the symbols that the static libpthread.a always links in</span>
<span id="L228"><span class="lineNum">     228</span>              :    whenever pthread_create is used, so there is no danger of a false</span>
<span id="L229"><span class="lineNum">     229</span>              :    negative result in any statically-linked, multi-threaded program.</span>
<span id="L230"><span class="lineNum">     230</span>              : </span>
<span id="L231"><span class="lineNum">     231</span>              :    For others, we choose pthread_cancel as a function that seems unlikely</span>
<span id="L232"><span class="lineNum">     232</span>              :    to be redefined by an interceptor library.  The bionic (Android) C</span>
<span id="L233"><span class="lineNum">     233</span>              :    library does not provide pthread_cancel, so we do use pthread_create</span>
<span id="L234"><span class="lineNum">     234</span>              :    there (and interceptor libraries lose).  */</span>
<span id="L235"><span class="lineNum">     235</span>              : </span>
<span id="L236"><span class="lineNum">     236</span>              : #ifdef __GLIBC__</span>
<span id="L237"><span class="lineNum">     237</span>              : __gthrw2(__gthrw_(__pthread_key_create),</span>
<span id="L238"><span class="lineNum">     238</span>              :          __pthread_key_create,</span>
<span id="L239"><span class="lineNum">     239</span>              :          pthread_key_create)</span>
<span id="L240"><span class="lineNum">     240</span>              : # define GTHR_ACTIVE_PROXY      __gthrw_(__pthread_key_create)</span>
<span id="L241"><span class="lineNum">     241</span>              : #elif defined (__BIONIC__)</span>
<span id="L242"><span class="lineNum">     242</span>              : # define GTHR_ACTIVE_PROXY      __gthrw_(pthread_create)</span>
<span id="L243"><span class="lineNum">     243</span>              : #else</span>
<span id="L244"><span class="lineNum">     244</span>              : # define GTHR_ACTIVE_PROXY      __gthrw_(pthread_cancel)</span>
<span id="L245"><span class="lineNum">     245</span>              : #endif</span>
<span id="L246"><span class="lineNum">     246</span>              : </span>
<span id="L247"><span class="lineNum">     247</span>              : static inline int</span>
<span id="L248"><span class="lineNum">     248</span>              : __gthread_active_p (void)</span>
<span id="L249"><span class="lineNum">     249</span>              : {</span>
<span id="L250"><span class="lineNum">     250</span>              :   static void *const __gthread_active_ptr</span>
<span id="L251"><span class="lineNum">     251</span>              :     = __extension__ (void *) &amp;GTHR_ACTIVE_PROXY;</span>
<span id="L252"><span class="lineNum">     252</span>              :   return __gthread_active_ptr != 0;</span>
<span id="L253"><span class="lineNum">     253</span>              : }</span>
<span id="L254"><span class="lineNum">     254</span>              : </span>
<span id="L255"><span class="lineNum">     255</span>              : #endif /* FreeBSD or Solaris */</span>
<span id="L256"><span class="lineNum">     256</span>              : </span>
<span id="L257"><span class="lineNum">     257</span>              : #else /* not __GXX_WEAK__ */</span>
<span id="L258"><span class="lineNum">     258</span>              : </span>
<span id="L259"><span class="lineNum">     259</span>              : /* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread</span>
<span id="L260"><span class="lineNum">     260</span>              :    calls in shared flavors of the HP-UX C library.  Most of the stubs</span>
<span id="L261"><span class="lineNum">     261</span>              :    have no functionality.  The details are described in the &quot;libc cumulative</span>
<span id="L262"><span class="lineNum">     262</span>              :    patch&quot; for each subversion of HP-UX 11.  There are two special interfaces</span>
<span id="L263"><span class="lineNum">     263</span>              :    provided for checking whether an application is linked to a shared pthread</span>
<span id="L264"><span class="lineNum">     264</span>              :    library or not.  However, these interfaces aren't available in early</span>
<span id="L265"><span class="lineNum">     265</span>              :    libpthread libraries.  We also need a test that works for archive</span>
<span id="L266"><span class="lineNum">     266</span>              :    libraries.  We can't use pthread_once as some libc versions call the</span>
<span id="L267"><span class="lineNum">     267</span>              :    init function.  We also can't use pthread_create or pthread_attr_init</span>
<span id="L268"><span class="lineNum">     268</span>              :    as these create a thread and thereby prevent changing the default stack</span>
<span id="L269"><span class="lineNum">     269</span>              :    size.  The function pthread_default_stacksize_np is available in both</span>
<span id="L270"><span class="lineNum">     270</span>              :    the archive and shared versions of libpthread.   It can be used to</span>
<span id="L271"><span class="lineNum">     271</span>              :    determine the default pthread stack size.  There is a stub in some</span>
<span id="L272"><span class="lineNum">     272</span>              :    shared libc versions which returns a zero size if pthreads are not</span>
<span id="L273"><span class="lineNum">     273</span>              :    active.  We provide an equivalent stub to handle cases where libc</span>
<span id="L274"><span class="lineNum">     274</span>              :    doesn't provide one.  */</span>
<span id="L275"><span class="lineNum">     275</span>              : </span>
<span id="L276"><span class="lineNum">     276</span>              : #if defined(__hppa__) &amp;&amp; defined(__hpux__)</span>
<span id="L277"><span class="lineNum">     277</span>              : </span>
<span id="L278"><span class="lineNum">     278</span>              : static volatile int __gthread_active = -1;</span>
<span id="L279"><span class="lineNum">     279</span>              : </span>
<span id="L280"><span class="lineNum">     280</span>              : static inline int</span>
<span id="L281"><span class="lineNum">     281</span>              : __gthread_active_p (void)</span>
<span id="L282"><span class="lineNum">     282</span>              : {</span>
<span id="L283"><span class="lineNum">     283</span>              :   /* Avoid reading __gthread_active twice on the main code path.  */</span>
<span id="L284"><span class="lineNum">     284</span>              :   int __gthread_active_latest_value = __gthread_active;</span>
<span id="L285"><span class="lineNum">     285</span>              :   size_t __s;</span>
<span id="L286"><span class="lineNum">     286</span>              : </span>
<span id="L287"><span class="lineNum">     287</span>              :   if (__builtin_expect (__gthread_active_latest_value &lt; 0, 0))</span>
<span id="L288"><span class="lineNum">     288</span>              :     {</span>
<span id="L289"><span class="lineNum">     289</span>              :       pthread_default_stacksize_np (0, &amp;__s);</span>
<span id="L290"><span class="lineNum">     290</span>              :       __gthread_active = __s ? 1 : 0;</span>
<span id="L291"><span class="lineNum">     291</span>              :       __gthread_active_latest_value = __gthread_active;</span>
<span id="L292"><span class="lineNum">     292</span>              :     }</span>
<span id="L293"><span class="lineNum">     293</span>              : </span>
<span id="L294"><span class="lineNum">     294</span>              :   return __gthread_active_latest_value != 0;</span>
<span id="L295"><span class="lineNum">     295</span>              : }</span>
<span id="L296"><span class="lineNum">     296</span>              : </span>
<span id="L297"><span class="lineNum">     297</span>              : #else /* not hppa-hpux */</span>
<span id="L298"><span class="lineNum">     298</span>              : </span>
<span id="L299"><span class="lineNum">     299</span>              : static inline int</span>
<span id="L300"><span class="lineNum">     300</span> <span class="tlaGNC tlaBgGNC">          14 : __gthread_active_p (void)</span></span>
<span id="L301"><span class="lineNum">     301</span>              : {</span>
<span id="L302"><span class="lineNum">     302</span> <span class="tlaGNC">          14 :   return 1;</span></span>
<span id="L303"><span class="lineNum">     303</span>              : }</span>
<span id="L304"><span class="lineNum">     304</span>              : </span>
<span id="L305"><span class="lineNum">     305</span>              : #endif /* hppa-hpux */</span>
<span id="L306"><span class="lineNum">     306</span>              : </span>
<span id="L307"><span class="lineNum">     307</span>              : #endif /* __GXX_WEAK__ */</span>
<span id="L308"><span class="lineNum">     308</span>              : </span>
<span id="L309"><span class="lineNum">     309</span>              : #ifdef _LIBOBJC</span>
<span id="L310"><span class="lineNum">     310</span>              : </span>
<span id="L311"><span class="lineNum">     311</span>              : /* This is the config.h file in libobjc/ */</span>
<span id="L312"><span class="lineNum">     312</span>              : #include &lt;config.h&gt;</span>
<span id="L313"><span class="lineNum">     313</span>              : </span>
<span id="L314"><span class="lineNum">     314</span>              : #ifdef HAVE_SCHED_H</span>
<span id="L315"><span class="lineNum">     315</span>              : # include &lt;sched.h&gt;</span>
<span id="L316"><span class="lineNum">     316</span>              : #endif</span>
<span id="L317"><span class="lineNum">     317</span>              : </span>
<span id="L318"><span class="lineNum">     318</span>              : /* Key structure for maintaining thread specific storage */</span>
<span id="L319"><span class="lineNum">     319</span>              : static pthread_key_t _objc_thread_storage;</span>
<span id="L320"><span class="lineNum">     320</span>              : static pthread_attr_t _objc_thread_attribs;</span>
<span id="L321"><span class="lineNum">     321</span>              : </span>
<span id="L322"><span class="lineNum">     322</span>              : /* Thread local storage for a single thread */</span>
<span id="L323"><span class="lineNum">     323</span>              : static void *thread_local_storage = NULL;</span>
<span id="L324"><span class="lineNum">     324</span>              : </span>
<span id="L325"><span class="lineNum">     325</span>              : /* Backend initialization functions */</span>
<span id="L326"><span class="lineNum">     326</span>              : </span>
<span id="L327"><span class="lineNum">     327</span>              : /* Initialize the threads subsystem.  */</span>
<span id="L328"><span class="lineNum">     328</span>              : static inline int</span>
<span id="L329"><span class="lineNum">     329</span>              : __gthread_objc_init_thread_system (void)</span>
<span id="L330"><span class="lineNum">     330</span>              : {</span>
<span id="L331"><span class="lineNum">     331</span>              :   if (__gthread_active_p ())</span>
<span id="L332"><span class="lineNum">     332</span>              :     {</span>
<span id="L333"><span class="lineNum">     333</span>              :       /* Initialize the thread storage key.  */</span>
<span id="L334"><span class="lineNum">     334</span>              :       if (__gthrw_(pthread_key_create) (&amp;_objc_thread_storage, NULL) == 0)</span>
<span id="L335"><span class="lineNum">     335</span>              :         {</span>
<span id="L336"><span class="lineNum">     336</span>              :           /* The normal default detach state for threads is</span>
<span id="L337"><span class="lineNum">     337</span>              :            * PTHREAD_CREATE_JOINABLE which causes threads to not die</span>
<span id="L338"><span class="lineNum">     338</span>              :            * when you think they should.  */</span>
<span id="L339"><span class="lineNum">     339</span>              :           if (__gthrw_(pthread_attr_init) (&amp;_objc_thread_attribs) == 0</span>
<span id="L340"><span class="lineNum">     340</span>              :               &amp;&amp; __gthrw_(pthread_attr_setdetachstate) (&amp;_objc_thread_attribs,</span>
<span id="L341"><span class="lineNum">     341</span>              :                                               PTHREAD_CREATE_DETACHED) == 0)</span>
<span id="L342"><span class="lineNum">     342</span>              :             return 0;</span>
<span id="L343"><span class="lineNum">     343</span>              :         }</span>
<span id="L344"><span class="lineNum">     344</span>              :     }</span>
<span id="L345"><span class="lineNum">     345</span>              : </span>
<span id="L346"><span class="lineNum">     346</span>              :   return -1;</span>
<span id="L347"><span class="lineNum">     347</span>              : }</span>
<span id="L348"><span class="lineNum">     348</span>              : </span>
<span id="L349"><span class="lineNum">     349</span>              : /* Close the threads subsystem.  */</span>
<span id="L350"><span class="lineNum">     350</span>              : static inline int</span>
<span id="L351"><span class="lineNum">     351</span>              : __gthread_objc_close_thread_system (void)</span>
<span id="L352"><span class="lineNum">     352</span>              : {</span>
<span id="L353"><span class="lineNum">     353</span>              :   if (__gthread_active_p ()</span>
<span id="L354"><span class="lineNum">     354</span>              :       &amp;&amp; __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0</span>
<span id="L355"><span class="lineNum">     355</span>              :       &amp;&amp; __gthrw_(pthread_attr_destroy) (&amp;_objc_thread_attribs) == 0)</span>
<span id="L356"><span class="lineNum">     356</span>              :     return 0;</span>
<span id="L357"><span class="lineNum">     357</span>              : </span>
<span id="L358"><span class="lineNum">     358</span>              :   return -1;</span>
<span id="L359"><span class="lineNum">     359</span>              : }</span>
<span id="L360"><span class="lineNum">     360</span>              : </span>
<span id="L361"><span class="lineNum">     361</span>              : /* Backend thread functions */</span>
<span id="L362"><span class="lineNum">     362</span>              : </span>
<span id="L363"><span class="lineNum">     363</span>              : /* Create a new thread of execution.  */</span>
<span id="L364"><span class="lineNum">     364</span>              : static inline objc_thread_t</span>
<span id="L365"><span class="lineNum">     365</span>              : __gthread_objc_thread_detach (void (*func)(void *), void *arg)</span>
<span id="L366"><span class="lineNum">     366</span>              : {</span>
<span id="L367"><span class="lineNum">     367</span>              :   objc_thread_t thread_id;</span>
<span id="L368"><span class="lineNum">     368</span>              :   pthread_t new_thread_handle;</span>
<span id="L369"><span class="lineNum">     369</span>              : </span>
<span id="L370"><span class="lineNum">     370</span>              :   if (!__gthread_active_p ())</span>
<span id="L371"><span class="lineNum">     371</span>              :     return NULL;</span>
<span id="L372"><span class="lineNum">     372</span>              : </span>
<span id="L373"><span class="lineNum">     373</span>              :   if (!(__gthrw_(pthread_create) (&amp;new_thread_handle, &amp;_objc_thread_attribs,</span>
<span id="L374"><span class="lineNum">     374</span>              :                                   (void *) func, arg)))</span>
<span id="L375"><span class="lineNum">     375</span>              :     thread_id = (objc_thread_t) new_thread_handle;</span>
<span id="L376"><span class="lineNum">     376</span>              :   else</span>
<span id="L377"><span class="lineNum">     377</span>              :     thread_id = NULL;</span>
<span id="L378"><span class="lineNum">     378</span>              : </span>
<span id="L379"><span class="lineNum">     379</span>              :   return thread_id;</span>
<span id="L380"><span class="lineNum">     380</span>              : }</span>
<span id="L381"><span class="lineNum">     381</span>              : </span>
<span id="L382"><span class="lineNum">     382</span>              : /* Set the current thread's priority.  */</span>
<span id="L383"><span class="lineNum">     383</span>              : static inline int</span>
<span id="L384"><span class="lineNum">     384</span>              : __gthread_objc_thread_set_priority (int priority)</span>
<span id="L385"><span class="lineNum">     385</span>              : {</span>
<span id="L386"><span class="lineNum">     386</span>              :   if (!__gthread_active_p ())</span>
<span id="L387"><span class="lineNum">     387</span>              :     return -1;</span>
<span id="L388"><span class="lineNum">     388</span>              :   else</span>
<span id="L389"><span class="lineNum">     389</span>              :     {</span>
<span id="L390"><span class="lineNum">     390</span>              : #ifdef _POSIX_PRIORITY_SCHEDULING</span>
<span id="L391"><span class="lineNum">     391</span>              : #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING</span>
<span id="L392"><span class="lineNum">     392</span>              :       pthread_t thread_id = __gthrw_(pthread_self) ();</span>
<span id="L393"><span class="lineNum">     393</span>              :       int policy;</span>
<span id="L394"><span class="lineNum">     394</span>              :       struct sched_param params;</span>
<span id="L395"><span class="lineNum">     395</span>              :       int priority_min, priority_max;</span>
<span id="L396"><span class="lineNum">     396</span>              : </span>
<span id="L397"><span class="lineNum">     397</span>              :       if (__gthrw_(pthread_getschedparam) (thread_id, &amp;policy, &amp;params) == 0)</span>
<span id="L398"><span class="lineNum">     398</span>              :         {</span>
<span id="L399"><span class="lineNum">     399</span>              :           if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)</span>
<span id="L400"><span class="lineNum">     400</span>              :             return -1;</span>
<span id="L401"><span class="lineNum">     401</span>              : </span>
<span id="L402"><span class="lineNum">     402</span>              :           if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)</span>
<span id="L403"><span class="lineNum">     403</span>              :             return -1;</span>
<span id="L404"><span class="lineNum">     404</span>              : </span>
<span id="L405"><span class="lineNum">     405</span>              :           if (priority &gt; priority_max)</span>
<span id="L406"><span class="lineNum">     406</span>              :             priority = priority_max;</span>
<span id="L407"><span class="lineNum">     407</span>              :           else if (priority &lt; priority_min)</span>
<span id="L408"><span class="lineNum">     408</span>              :             priority = priority_min;</span>
<span id="L409"><span class="lineNum">     409</span>              :           params.sched_priority = priority;</span>
<span id="L410"><span class="lineNum">     410</span>              : </span>
<span id="L411"><span class="lineNum">     411</span>              :           /*</span>
<span id="L412"><span class="lineNum">     412</span>              :            * The solaris 7 and several other man pages incorrectly state that</span>
<span id="L413"><span class="lineNum">     413</span>              :            * this should be a pointer to policy but pthread.h is universally</span>
<span id="L414"><span class="lineNum">     414</span>              :            * at odds with this.</span>
<span id="L415"><span class="lineNum">     415</span>              :            */</span>
<span id="L416"><span class="lineNum">     416</span>              :           if (__gthrw_(pthread_setschedparam) (thread_id, policy, &amp;params) == 0)</span>
<span id="L417"><span class="lineNum">     417</span>              :             return 0;</span>
<span id="L418"><span class="lineNum">     418</span>              :         }</span>
<span id="L419"><span class="lineNum">     419</span>              : #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */</span>
<span id="L420"><span class="lineNum">     420</span>              : #endif /* _POSIX_PRIORITY_SCHEDULING */</span>
<span id="L421"><span class="lineNum">     421</span>              :       return -1;</span>
<span id="L422"><span class="lineNum">     422</span>              :     }</span>
<span id="L423"><span class="lineNum">     423</span>              : }</span>
<span id="L424"><span class="lineNum">     424</span>              : </span>
<span id="L425"><span class="lineNum">     425</span>              : /* Return the current thread's priority.  */</span>
<span id="L426"><span class="lineNum">     426</span>              : static inline int</span>
<span id="L427"><span class="lineNum">     427</span>              : __gthread_objc_thread_get_priority (void)</span>
<span id="L428"><span class="lineNum">     428</span>              : {</span>
<span id="L429"><span class="lineNum">     429</span>              : #ifdef _POSIX_PRIORITY_SCHEDULING</span>
<span id="L430"><span class="lineNum">     430</span>              : #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING</span>
<span id="L431"><span class="lineNum">     431</span>              :   if (__gthread_active_p ())</span>
<span id="L432"><span class="lineNum">     432</span>              :     {</span>
<span id="L433"><span class="lineNum">     433</span>              :       int policy;</span>
<span id="L434"><span class="lineNum">     434</span>              :       struct sched_param params;</span>
<span id="L435"><span class="lineNum">     435</span>              : </span>
<span id="L436"><span class="lineNum">     436</span>              :       if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &amp;policy, &amp;params) == 0)</span>
<span id="L437"><span class="lineNum">     437</span>              :         return params.sched_priority;</span>
<span id="L438"><span class="lineNum">     438</span>              :       else</span>
<span id="L439"><span class="lineNum">     439</span>              :         return -1;</span>
<span id="L440"><span class="lineNum">     440</span>              :     }</span>
<span id="L441"><span class="lineNum">     441</span>              :   else</span>
<span id="L442"><span class="lineNum">     442</span>              : #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */</span>
<span id="L443"><span class="lineNum">     443</span>              : #endif /* _POSIX_PRIORITY_SCHEDULING */</span>
<span id="L444"><span class="lineNum">     444</span>              :     return OBJC_THREAD_INTERACTIVE_PRIORITY;</span>
<span id="L445"><span class="lineNum">     445</span>              : }</span>
<span id="L446"><span class="lineNum">     446</span>              : </span>
<span id="L447"><span class="lineNum">     447</span>              : /* Yield our process time to another thread.  */</span>
<span id="L448"><span class="lineNum">     448</span>              : static inline void</span>
<span id="L449"><span class="lineNum">     449</span>              : __gthread_objc_thread_yield (void)</span>
<span id="L450"><span class="lineNum">     450</span>              : {</span>
<span id="L451"><span class="lineNum">     451</span>              :   if (__gthread_active_p ())</span>
<span id="L452"><span class="lineNum">     452</span>              :     __gthrw_(sched_yield) ();</span>
<span id="L453"><span class="lineNum">     453</span>              : }</span>
<span id="L454"><span class="lineNum">     454</span>              : </span>
<span id="L455"><span class="lineNum">     455</span>              : /* Terminate the current thread.  */</span>
<span id="L456"><span class="lineNum">     456</span>              : static inline int</span>
<span id="L457"><span class="lineNum">     457</span>              : __gthread_objc_thread_exit (void)</span>
<span id="L458"><span class="lineNum">     458</span>              : {</span>
<span id="L459"><span class="lineNum">     459</span>              :   if (__gthread_active_p ())</span>
<span id="L460"><span class="lineNum">     460</span>              :     /* exit the thread */</span>
<span id="L461"><span class="lineNum">     461</span>              :     __gthrw_(pthread_exit) (&amp;__objc_thread_exit_status);</span>
<span id="L462"><span class="lineNum">     462</span>              : </span>
<span id="L463"><span class="lineNum">     463</span>              :   /* Failed if we reached here */</span>
<span id="L464"><span class="lineNum">     464</span>              :   return -1;</span>
<span id="L465"><span class="lineNum">     465</span>              : }</span>
<span id="L466"><span class="lineNum">     466</span>              : </span>
<span id="L467"><span class="lineNum">     467</span>              : /* Returns an integer value which uniquely describes a thread.  */</span>
<span id="L468"><span class="lineNum">     468</span>              : static inline objc_thread_t</span>
<span id="L469"><span class="lineNum">     469</span>              : __gthread_objc_thread_id (void)</span>
<span id="L470"><span class="lineNum">     470</span>              : {</span>
<span id="L471"><span class="lineNum">     471</span>              :   if (__gthread_active_p ())</span>
<span id="L472"><span class="lineNum">     472</span>              :     return (objc_thread_t) __gthrw_(pthread_self) ();</span>
<span id="L473"><span class="lineNum">     473</span>              :   else</span>
<span id="L474"><span class="lineNum">     474</span>              :     return (objc_thread_t) 1;</span>
<span id="L475"><span class="lineNum">     475</span>              : }</span>
<span id="L476"><span class="lineNum">     476</span>              : </span>
<span id="L477"><span class="lineNum">     477</span>              : /* Sets the thread's local storage pointer.  */</span>
<span id="L478"><span class="lineNum">     478</span>              : static inline int</span>
<span id="L479"><span class="lineNum">     479</span>              : __gthread_objc_thread_set_data (void *value)</span>
<span id="L480"><span class="lineNum">     480</span>              : {</span>
<span id="L481"><span class="lineNum">     481</span>              :   if (__gthread_active_p ())</span>
<span id="L482"><span class="lineNum">     482</span>              :     return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);</span>
<span id="L483"><span class="lineNum">     483</span>              :   else</span>
<span id="L484"><span class="lineNum">     484</span>              :     {</span>
<span id="L485"><span class="lineNum">     485</span>              :       thread_local_storage = value;</span>
<span id="L486"><span class="lineNum">     486</span>              :       return 0;</span>
<span id="L487"><span class="lineNum">     487</span>              :     }</span>
<span id="L488"><span class="lineNum">     488</span>              : }</span>
<span id="L489"><span class="lineNum">     489</span>              : </span>
<span id="L490"><span class="lineNum">     490</span>              : /* Returns the thread's local storage pointer.  */</span>
<span id="L491"><span class="lineNum">     491</span>              : static inline void *</span>
<span id="L492"><span class="lineNum">     492</span>              : __gthread_objc_thread_get_data (void)</span>
<span id="L493"><span class="lineNum">     493</span>              : {</span>
<span id="L494"><span class="lineNum">     494</span>              :   if (__gthread_active_p ())</span>
<span id="L495"><span class="lineNum">     495</span>              :     return __gthrw_(pthread_getspecific) (_objc_thread_storage);</span>
<span id="L496"><span class="lineNum">     496</span>              :   else</span>
<span id="L497"><span class="lineNum">     497</span>              :     return thread_local_storage;</span>
<span id="L498"><span class="lineNum">     498</span>              : }</span>
<span id="L499"><span class="lineNum">     499</span>              : </span>
<span id="L500"><span class="lineNum">     500</span>              : /* Backend mutex functions */</span>
<span id="L501"><span class="lineNum">     501</span>              : </span>
<span id="L502"><span class="lineNum">     502</span>              : /* Allocate a mutex.  */</span>
<span id="L503"><span class="lineNum">     503</span>              : static inline int</span>
<span id="L504"><span class="lineNum">     504</span>              : __gthread_objc_mutex_allocate (objc_mutex_t mutex)</span>
<span id="L505"><span class="lineNum">     505</span>              : {</span>
<span id="L506"><span class="lineNum">     506</span>              :   if (__gthread_active_p ())</span>
<span id="L507"><span class="lineNum">     507</span>              :     {</span>
<span id="L508"><span class="lineNum">     508</span>              :       mutex-&gt;backend = objc_malloc (sizeof (pthread_mutex_t));</span>
<span id="L509"><span class="lineNum">     509</span>              : </span>
<span id="L510"><span class="lineNum">     510</span>              :       if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex-&gt;backend, NULL))</span>
<span id="L511"><span class="lineNum">     511</span>              :         {</span>
<span id="L512"><span class="lineNum">     512</span>              :           objc_free (mutex-&gt;backend);</span>
<span id="L513"><span class="lineNum">     513</span>              :           mutex-&gt;backend = NULL;</span>
<span id="L514"><span class="lineNum">     514</span>              :           return -1;</span>
<span id="L515"><span class="lineNum">     515</span>              :         }</span>
<span id="L516"><span class="lineNum">     516</span>              :     }</span>
<span id="L517"><span class="lineNum">     517</span>              : </span>
<span id="L518"><span class="lineNum">     518</span>              :   return 0;</span>
<span id="L519"><span class="lineNum">     519</span>              : }</span>
<span id="L520"><span class="lineNum">     520</span>              : </span>
<span id="L521"><span class="lineNum">     521</span>              : /* Deallocate a mutex.  */</span>
<span id="L522"><span class="lineNum">     522</span>              : static inline int</span>
<span id="L523"><span class="lineNum">     523</span>              : __gthread_objc_mutex_deallocate (objc_mutex_t mutex)</span>
<span id="L524"><span class="lineNum">     524</span>              : {</span>
<span id="L525"><span class="lineNum">     525</span>              :   if (__gthread_active_p ())</span>
<span id="L526"><span class="lineNum">     526</span>              :     {</span>
<span id="L527"><span class="lineNum">     527</span>              :       int count;</span>
<span id="L528"><span class="lineNum">     528</span>              : </span>
<span id="L529"><span class="lineNum">     529</span>              :       /*</span>
<span id="L530"><span class="lineNum">     530</span>              :        * Posix Threads specifically require that the thread be unlocked</span>
<span id="L531"><span class="lineNum">     531</span>              :        * for __gthrw_(pthread_mutex_destroy) to work.</span>
<span id="L532"><span class="lineNum">     532</span>              :        */</span>
<span id="L533"><span class="lineNum">     533</span>              : </span>
<span id="L534"><span class="lineNum">     534</span>              :       do</span>
<span id="L535"><span class="lineNum">     535</span>              :         {</span>
<span id="L536"><span class="lineNum">     536</span>              :           count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex-&gt;backend);</span>
<span id="L537"><span class="lineNum">     537</span>              :           if (count &lt; 0)</span>
<span id="L538"><span class="lineNum">     538</span>              :             return -1;</span>
<span id="L539"><span class="lineNum">     539</span>              :         }</span>
<span id="L540"><span class="lineNum">     540</span>              :       while (count);</span>
<span id="L541"><span class="lineNum">     541</span>              : </span>
<span id="L542"><span class="lineNum">     542</span>              :       if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex-&gt;backend))</span>
<span id="L543"><span class="lineNum">     543</span>              :         return -1;</span>
<span id="L544"><span class="lineNum">     544</span>              : </span>
<span id="L545"><span class="lineNum">     545</span>              :       objc_free (mutex-&gt;backend);</span>
<span id="L546"><span class="lineNum">     546</span>              :       mutex-&gt;backend = NULL;</span>
<span id="L547"><span class="lineNum">     547</span>              :     }</span>
<span id="L548"><span class="lineNum">     548</span>              :   return 0;</span>
<span id="L549"><span class="lineNum">     549</span>              : }</span>
<span id="L550"><span class="lineNum">     550</span>              : </span>
<span id="L551"><span class="lineNum">     551</span>              : /* Grab a lock on a mutex.  */</span>
<span id="L552"><span class="lineNum">     552</span>              : static inline int</span>
<span id="L553"><span class="lineNum">     553</span>              : __gthread_objc_mutex_lock (objc_mutex_t mutex)</span>
<span id="L554"><span class="lineNum">     554</span>              : {</span>
<span id="L555"><span class="lineNum">     555</span>              :   if (__gthread_active_p ()</span>
<span id="L556"><span class="lineNum">     556</span>              :       &amp;&amp; __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex-&gt;backend) != 0)</span>
<span id="L557"><span class="lineNum">     557</span>              :     {</span>
<span id="L558"><span class="lineNum">     558</span>              :       return -1;</span>
<span id="L559"><span class="lineNum">     559</span>              :     }</span>
<span id="L560"><span class="lineNum">     560</span>              : </span>
<span id="L561"><span class="lineNum">     561</span>              :   return 0;</span>
<span id="L562"><span class="lineNum">     562</span>              : }</span>
<span id="L563"><span class="lineNum">     563</span>              : </span>
<span id="L564"><span class="lineNum">     564</span>              : /* Try to grab a lock on a mutex.  */</span>
<span id="L565"><span class="lineNum">     565</span>              : static inline int</span>
<span id="L566"><span class="lineNum">     566</span>              : __gthread_objc_mutex_trylock (objc_mutex_t mutex)</span>
<span id="L567"><span class="lineNum">     567</span>              : {</span>
<span id="L568"><span class="lineNum">     568</span>              :   if (__gthread_active_p ()</span>
<span id="L569"><span class="lineNum">     569</span>              :       &amp;&amp; __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex-&gt;backend) != 0)</span>
<span id="L570"><span class="lineNum">     570</span>              :     {</span>
<span id="L571"><span class="lineNum">     571</span>              :       return -1;</span>
<span id="L572"><span class="lineNum">     572</span>              :     }</span>
<span id="L573"><span class="lineNum">     573</span>              : </span>
<span id="L574"><span class="lineNum">     574</span>              :   return 0;</span>
<span id="L575"><span class="lineNum">     575</span>              : }</span>
<span id="L576"><span class="lineNum">     576</span>              : </span>
<span id="L577"><span class="lineNum">     577</span>              : /* Unlock the mutex */</span>
<span id="L578"><span class="lineNum">     578</span>              : static inline int</span>
<span id="L579"><span class="lineNum">     579</span>              : __gthread_objc_mutex_unlock (objc_mutex_t mutex)</span>
<span id="L580"><span class="lineNum">     580</span>              : {</span>
<span id="L581"><span class="lineNum">     581</span>              :   if (__gthread_active_p ()</span>
<span id="L582"><span class="lineNum">     582</span>              :       &amp;&amp; __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex-&gt;backend) != 0)</span>
<span id="L583"><span class="lineNum">     583</span>              :     {</span>
<span id="L584"><span class="lineNum">     584</span>              :       return -1;</span>
<span id="L585"><span class="lineNum">     585</span>              :     }</span>
<span id="L586"><span class="lineNum">     586</span>              : </span>
<span id="L587"><span class="lineNum">     587</span>              :   return 0;</span>
<span id="L588"><span class="lineNum">     588</span>              : }</span>
<span id="L589"><span class="lineNum">     589</span>              : </span>
<span id="L590"><span class="lineNum">     590</span>              : /* Backend condition mutex functions */</span>
<span id="L591"><span class="lineNum">     591</span>              : </span>
<span id="L592"><span class="lineNum">     592</span>              : /* Allocate a condition.  */</span>
<span id="L593"><span class="lineNum">     593</span>              : static inline int</span>
<span id="L594"><span class="lineNum">     594</span>              : __gthread_objc_condition_allocate (objc_condition_t condition)</span>
<span id="L595"><span class="lineNum">     595</span>              : {</span>
<span id="L596"><span class="lineNum">     596</span>              :   if (__gthread_active_p ())</span>
<span id="L597"><span class="lineNum">     597</span>              :     {</span>
<span id="L598"><span class="lineNum">     598</span>              :       condition-&gt;backend = objc_malloc (sizeof (pthread_cond_t));</span>
<span id="L599"><span class="lineNum">     599</span>              : </span>
<span id="L600"><span class="lineNum">     600</span>              :       if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition-&gt;backend, NULL))</span>
<span id="L601"><span class="lineNum">     601</span>              :         {</span>
<span id="L602"><span class="lineNum">     602</span>              :           objc_free (condition-&gt;backend);</span>
<span id="L603"><span class="lineNum">     603</span>              :           condition-&gt;backend = NULL;</span>
<span id="L604"><span class="lineNum">     604</span>              :           return -1;</span>
<span id="L605"><span class="lineNum">     605</span>              :         }</span>
<span id="L606"><span class="lineNum">     606</span>              :     }</span>
<span id="L607"><span class="lineNum">     607</span>              : </span>
<span id="L608"><span class="lineNum">     608</span>              :   return 0;</span>
<span id="L609"><span class="lineNum">     609</span>              : }</span>
<span id="L610"><span class="lineNum">     610</span>              : </span>
<span id="L611"><span class="lineNum">     611</span>              : /* Deallocate a condition.  */</span>
<span id="L612"><span class="lineNum">     612</span>              : static inline int</span>
<span id="L613"><span class="lineNum">     613</span>              : __gthread_objc_condition_deallocate (objc_condition_t condition)</span>
<span id="L614"><span class="lineNum">     614</span>              : {</span>
<span id="L615"><span class="lineNum">     615</span>              :   if (__gthread_active_p ())</span>
<span id="L616"><span class="lineNum">     616</span>              :     {</span>
<span id="L617"><span class="lineNum">     617</span>              :       if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition-&gt;backend))</span>
<span id="L618"><span class="lineNum">     618</span>              :         return -1;</span>
<span id="L619"><span class="lineNum">     619</span>              : </span>
<span id="L620"><span class="lineNum">     620</span>              :       objc_free (condition-&gt;backend);</span>
<span id="L621"><span class="lineNum">     621</span>              :       condition-&gt;backend = NULL;</span>
<span id="L622"><span class="lineNum">     622</span>              :     }</span>
<span id="L623"><span class="lineNum">     623</span>              :   return 0;</span>
<span id="L624"><span class="lineNum">     624</span>              : }</span>
<span id="L625"><span class="lineNum">     625</span>              : </span>
<span id="L626"><span class="lineNum">     626</span>              : /* Wait on the condition */</span>
<span id="L627"><span class="lineNum">     627</span>              : static inline int</span>
<span id="L628"><span class="lineNum">     628</span>              : __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)</span>
<span id="L629"><span class="lineNum">     629</span>              : {</span>
<span id="L630"><span class="lineNum">     630</span>              :   if (__gthread_active_p ())</span>
<span id="L631"><span class="lineNum">     631</span>              :     return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition-&gt;backend,</span>
<span id="L632"><span class="lineNum">     632</span>              :                               (pthread_mutex_t *) mutex-&gt;backend);</span>
<span id="L633"><span class="lineNum">     633</span>              :   else</span>
<span id="L634"><span class="lineNum">     634</span>              :     return 0;</span>
<span id="L635"><span class="lineNum">     635</span>              : }</span>
<span id="L636"><span class="lineNum">     636</span>              : </span>
<span id="L637"><span class="lineNum">     637</span>              : /* Wake up all threads waiting on this condition.  */</span>
<span id="L638"><span class="lineNum">     638</span>              : static inline int</span>
<span id="L639"><span class="lineNum">     639</span>              : __gthread_objc_condition_broadcast (objc_condition_t condition)</span>
<span id="L640"><span class="lineNum">     640</span>              : {</span>
<span id="L641"><span class="lineNum">     641</span>              :   if (__gthread_active_p ())</span>
<span id="L642"><span class="lineNum">     642</span>              :     return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition-&gt;backend);</span>
<span id="L643"><span class="lineNum">     643</span>              :   else</span>
<span id="L644"><span class="lineNum">     644</span>              :     return 0;</span>
<span id="L645"><span class="lineNum">     645</span>              : }</span>
<span id="L646"><span class="lineNum">     646</span>              : </span>
<span id="L647"><span class="lineNum">     647</span>              : /* Wake up one thread waiting on this condition.  */</span>
<span id="L648"><span class="lineNum">     648</span>              : static inline int</span>
<span id="L649"><span class="lineNum">     649</span>              : __gthread_objc_condition_signal (objc_condition_t condition)</span>
<span id="L650"><span class="lineNum">     650</span>              : {</span>
<span id="L651"><span class="lineNum">     651</span>              :   if (__gthread_active_p ())</span>
<span id="L652"><span class="lineNum">     652</span>              :     return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition-&gt;backend);</span>
<span id="L653"><span class="lineNum">     653</span>              :   else</span>
<span id="L654"><span class="lineNum">     654</span>              :     return 0;</span>
<span id="L655"><span class="lineNum">     655</span>              : }</span>
<span id="L656"><span class="lineNum">     656</span>              : </span>
<span id="L657"><span class="lineNum">     657</span>              : #else /* _LIBOBJC */</span>
<span id="L658"><span class="lineNum">     658</span>              : </span>
<span id="L659"><span class="lineNum">     659</span>              : static inline int</span>
<span id="L660"><span class="lineNum">     660</span>              : __gthread_create (__gthread_t *__threadid, void *(*__func) (void*),</span>
<span id="L661"><span class="lineNum">     661</span>              :                   void *__args)</span>
<span id="L662"><span class="lineNum">     662</span>              : {</span>
<span id="L663"><span class="lineNum">     663</span>              :   return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);</span>
<span id="L664"><span class="lineNum">     664</span>              : }</span>
<span id="L665"><span class="lineNum">     665</span>              : </span>
<span id="L666"><span class="lineNum">     666</span>              : static inline int</span>
<span id="L667"><span class="lineNum">     667</span>              : __gthread_join (__gthread_t __threadid, void **__value_ptr)</span>
<span id="L668"><span class="lineNum">     668</span>              : {</span>
<span id="L669"><span class="lineNum">     669</span>              :   return __gthrw_(pthread_join) (__threadid, __value_ptr);</span>
<span id="L670"><span class="lineNum">     670</span>              : }</span>
<span id="L671"><span class="lineNum">     671</span>              : </span>
<span id="L672"><span class="lineNum">     672</span>              : static inline int</span>
<span id="L673"><span class="lineNum">     673</span>              : __gthread_detach (__gthread_t __threadid)</span>
<span id="L674"><span class="lineNum">     674</span>              : {</span>
<span id="L675"><span class="lineNum">     675</span>              :   return __gthrw_(pthread_detach) (__threadid);</span>
<span id="L676"><span class="lineNum">     676</span>              : }</span>
<span id="L677"><span class="lineNum">     677</span>              : </span>
<span id="L678"><span class="lineNum">     678</span>              : static inline int</span>
<span id="L679"><span class="lineNum">     679</span>              : __gthread_equal (__gthread_t __t1, __gthread_t __t2)</span>
<span id="L680"><span class="lineNum">     680</span>              : {</span>
<span id="L681"><span class="lineNum">     681</span>              :   return __gthrw_(pthread_equal) (__t1, __t2);</span>
<span id="L682"><span class="lineNum">     682</span>              : }</span>
<span id="L683"><span class="lineNum">     683</span>              : </span>
<span id="L684"><span class="lineNum">     684</span>              : static inline __gthread_t</span>
<span id="L685"><span class="lineNum">     685</span>              : __gthread_self (void)</span>
<span id="L686"><span class="lineNum">     686</span>              : {</span>
<span id="L687"><span class="lineNum">     687</span>              :   return __gthrw_(pthread_self) ();</span>
<span id="L688"><span class="lineNum">     688</span>              : }</span>
<span id="L689"><span class="lineNum">     689</span>              : </span>
<span id="L690"><span class="lineNum">     690</span>              : static inline int</span>
<span id="L691"><span class="lineNum">     691</span>              : __gthread_yield (void)</span>
<span id="L692"><span class="lineNum">     692</span>              : {</span>
<span id="L693"><span class="lineNum">     693</span>              :   return __gthrw_(sched_yield) ();</span>
<span id="L694"><span class="lineNum">     694</span>              : }</span>
<span id="L695"><span class="lineNum">     695</span>              : </span>
<span id="L696"><span class="lineNum">     696</span>              : static inline int</span>
<span id="L697"><span class="lineNum">     697</span>              : __gthread_once (__gthread_once_t *__once, void (*__func) (void))</span>
<span id="L698"><span class="lineNum">     698</span>              : {</span>
<span id="L699"><span class="lineNum">     699</span>              :   if (__gthread_active_p ())</span>
<span id="L700"><span class="lineNum">     700</span>              :     return __gthrw_(pthread_once) (__once, __func);</span>
<span id="L701"><span class="lineNum">     701</span>              :   else</span>
<span id="L702"><span class="lineNum">     702</span>              :     return -1;</span>
<span id="L703"><span class="lineNum">     703</span>              : }</span>
<span id="L704"><span class="lineNum">     704</span>              : </span>
<span id="L705"><span class="lineNum">     705</span>              : static inline int</span>
<span id="L706"><span class="lineNum">     706</span>              : __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))</span>
<span id="L707"><span class="lineNum">     707</span>              : {</span>
<span id="L708"><span class="lineNum">     708</span>              :   return __gthrw_(pthread_key_create) (__key, __dtor);</span>
<span id="L709"><span class="lineNum">     709</span>              : }</span>
<span id="L710"><span class="lineNum">     710</span>              : </span>
<span id="L711"><span class="lineNum">     711</span>              : static inline int</span>
<span id="L712"><span class="lineNum">     712</span>              : __gthread_key_delete (__gthread_key_t __key)</span>
<span id="L713"><span class="lineNum">     713</span>              : {</span>
<span id="L714"><span class="lineNum">     714</span>              :   return __gthrw_(pthread_key_delete) (__key);</span>
<span id="L715"><span class="lineNum">     715</span>              : }</span>
<span id="L716"><span class="lineNum">     716</span>              : </span>
<span id="L717"><span class="lineNum">     717</span>              : static inline void *</span>
<span id="L718"><span class="lineNum">     718</span>              : __gthread_getspecific (__gthread_key_t __key)</span>
<span id="L719"><span class="lineNum">     719</span>              : {</span>
<span id="L720"><span class="lineNum">     720</span>              :   return __gthrw_(pthread_getspecific) (__key);</span>
<span id="L721"><span class="lineNum">     721</span>              : }</span>
<span id="L722"><span class="lineNum">     722</span>              : </span>
<span id="L723"><span class="lineNum">     723</span>              : static inline int</span>
<span id="L724"><span class="lineNum">     724</span>              : __gthread_setspecific (__gthread_key_t __key, const void *__ptr)</span>
<span id="L725"><span class="lineNum">     725</span>              : {</span>
<span id="L726"><span class="lineNum">     726</span>              :   return __gthrw_(pthread_setspecific) (__key, __ptr);</span>
<span id="L727"><span class="lineNum">     727</span>              : }</span>
<span id="L728"><span class="lineNum">     728</span>              : </span>
<span id="L729"><span class="lineNum">     729</span>              : static inline void</span>
<span id="L730"><span class="lineNum">     730</span>              : __gthread_mutex_init_function (__gthread_mutex_t *__mutex)</span>
<span id="L731"><span class="lineNum">     731</span>              : {</span>
<span id="L732"><span class="lineNum">     732</span>              :   if (__gthread_active_p ())</span>
<span id="L733"><span class="lineNum">     733</span>              :     __gthrw_(pthread_mutex_init) (__mutex, NULL);</span>
<span id="L734"><span class="lineNum">     734</span>              : }</span>
<span id="L735"><span class="lineNum">     735</span>              : </span>
<span id="L736"><span class="lineNum">     736</span>              : static inline int</span>
<span id="L737"><span class="lineNum">     737</span>              : __gthread_mutex_destroy (__gthread_mutex_t *__mutex)</span>
<span id="L738"><span class="lineNum">     738</span>              : {</span>
<span id="L739"><span class="lineNum">     739</span>              :   if (__gthread_active_p ())</span>
<span id="L740"><span class="lineNum">     740</span>              :     return __gthrw_(pthread_mutex_destroy) (__mutex);</span>
<span id="L741"><span class="lineNum">     741</span>              :   else</span>
<span id="L742"><span class="lineNum">     742</span>              :     return 0;</span>
<span id="L743"><span class="lineNum">     743</span>              : }</span>
<span id="L744"><span class="lineNum">     744</span>              : </span>
<span id="L745"><span class="lineNum">     745</span>              : static inline int</span>
<span id="L746"><span class="lineNum">     746</span> <span class="tlaGNC">           7 : __gthread_mutex_lock (__gthread_mutex_t *__mutex)</span></span>
<span id="L747"><span class="lineNum">     747</span>              : {</span>
<span id="L748"><span class="lineNum">     748</span> <span class="tlaGNC">           7 :   if (__gthread_active_p ())</span></span>
<span id="L749"><span class="lineNum">     749</span> <span class="tlaGNC">           7 :     return __gthrw_(pthread_mutex_lock) (__mutex);</span></span>
<span id="L750"><span class="lineNum">     750</span>              :   else</span>
<span id="L751"><span class="lineNum">     751</span> <span class="tlaUNC tlaBgUNC">           0 :     return 0;</span></span>
<span id="L752"><span class="lineNum">     752</span>              : }</span>
<span id="L753"><span class="lineNum">     753</span>              : </span>
<span id="L754"><span class="lineNum">     754</span>              : static inline int</span>
<span id="L755"><span class="lineNum">     755</span>              : __gthread_mutex_trylock (__gthread_mutex_t *__mutex)</span>
<span id="L756"><span class="lineNum">     756</span>              : {</span>
<span id="L757"><span class="lineNum">     757</span>              :   if (__gthread_active_p ())</span>
<span id="L758"><span class="lineNum">     758</span>              :     return __gthrw_(pthread_mutex_trylock) (__mutex);</span>
<span id="L759"><span class="lineNum">     759</span>              :   else</span>
<span id="L760"><span class="lineNum">     760</span>              :     return 0;</span>
<span id="L761"><span class="lineNum">     761</span>              : }</span>
<span id="L762"><span class="lineNum">     762</span>              : </span>
<span id="L763"><span class="lineNum">     763</span>              : #if _GTHREAD_USE_MUTEX_TIMEDLOCK</span>
<span id="L764"><span class="lineNum">     764</span>              : static inline int</span>
<span id="L765"><span class="lineNum">     765</span>              : __gthread_mutex_timedlock (__gthread_mutex_t *__mutex,</span>
<span id="L766"><span class="lineNum">     766</span>              :                            const __gthread_time_t *__abs_timeout)</span>
<span id="L767"><span class="lineNum">     767</span>              : {</span>
<span id="L768"><span class="lineNum">     768</span>              :   if (__gthread_active_p ())</span>
<span id="L769"><span class="lineNum">     769</span>              :     return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);</span>
<span id="L770"><span class="lineNum">     770</span>              :   else</span>
<span id="L771"><span class="lineNum">     771</span>              :     return 0;</span>
<span id="L772"><span class="lineNum">     772</span>              : }</span>
<span id="L773"><span class="lineNum">     773</span>              : #endif</span>
<span id="L774"><span class="lineNum">     774</span>              : </span>
<span id="L775"><span class="lineNum">     775</span>              : static inline int</span>
<span id="L776"><span class="lineNum">     776</span> <span class="tlaGNC tlaBgGNC">           7 : __gthread_mutex_unlock (__gthread_mutex_t *__mutex)</span></span>
<span id="L777"><span class="lineNum">     777</span>              : {</span>
<span id="L778"><span class="lineNum">     778</span> <span class="tlaGNC">           7 :   if (__gthread_active_p ())</span></span>
<span id="L779"><span class="lineNum">     779</span> <span class="tlaGNC">           7 :     return __gthrw_(pthread_mutex_unlock) (__mutex);</span></span>
<span id="L780"><span class="lineNum">     780</span>              :   else</span>
<span id="L781"><span class="lineNum">     781</span> <span class="tlaUNC tlaBgUNC">           0 :     return 0;</span></span>
<span id="L782"><span class="lineNum">     782</span>              : }</span>
<span id="L783"><span class="lineNum">     783</span>              : </span>
<span id="L784"><span class="lineNum">     784</span>              : #if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \</span>
<span id="L785"><span class="lineNum">     785</span>              :   || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)</span>
<span id="L786"><span class="lineNum">     786</span>              : static inline int</span>
<span id="L787"><span class="lineNum">     787</span>              : __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)</span>
<span id="L788"><span class="lineNum">     788</span>              : {</span>
<span id="L789"><span class="lineNum">     789</span>              :   if (__gthread_active_p ())</span>
<span id="L790"><span class="lineNum">     790</span>              :     {</span>
<span id="L791"><span class="lineNum">     791</span>              :       pthread_mutexattr_t __attr;</span>
<span id="L792"><span class="lineNum">     792</span>              :       int __r;</span>
<span id="L793"><span class="lineNum">     793</span>              : </span>
<span id="L794"><span class="lineNum">     794</span>              :       __r = __gthrw_(pthread_mutexattr_init) (&amp;__attr);</span>
<span id="L795"><span class="lineNum">     795</span>              :       if (!__r)</span>
<span id="L796"><span class="lineNum">     796</span>              :         __r = __gthrw_(pthread_mutexattr_settype) (&amp;__attr,</span>
<span id="L797"><span class="lineNum">     797</span>              :                                                    PTHREAD_MUTEX_RECURSIVE);</span>
<span id="L798"><span class="lineNum">     798</span>              :       if (!__r)</span>
<span id="L799"><span class="lineNum">     799</span>              :         __r = __gthrw_(pthread_mutex_init) (__mutex, &amp;__attr);</span>
<span id="L800"><span class="lineNum">     800</span>              :       if (!__r)</span>
<span id="L801"><span class="lineNum">     801</span>              :         __r = __gthrw_(pthread_mutexattr_destroy) (&amp;__attr);</span>
<span id="L802"><span class="lineNum">     802</span>              :       return __r;</span>
<span id="L803"><span class="lineNum">     803</span>              :     }</span>
<span id="L804"><span class="lineNum">     804</span>              :   return 0;</span>
<span id="L805"><span class="lineNum">     805</span>              : }</span>
<span id="L806"><span class="lineNum">     806</span>              : #endif</span>
<span id="L807"><span class="lineNum">     807</span>              : </span>
<span id="L808"><span class="lineNum">     808</span>              : static inline int</span>
<span id="L809"><span class="lineNum">     809</span>              : __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)</span>
<span id="L810"><span class="lineNum">     810</span>              : {</span>
<span id="L811"><span class="lineNum">     811</span>              :   return __gthread_mutex_lock (__mutex);</span>
<span id="L812"><span class="lineNum">     812</span>              : }</span>
<span id="L813"><span class="lineNum">     813</span>              : </span>
<span id="L814"><span class="lineNum">     814</span>              : static inline int</span>
<span id="L815"><span class="lineNum">     815</span>              : __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)</span>
<span id="L816"><span class="lineNum">     816</span>              : {</span>
<span id="L817"><span class="lineNum">     817</span>              :   return __gthread_mutex_trylock (__mutex);</span>
<span id="L818"><span class="lineNum">     818</span>              : }</span>
<span id="L819"><span class="lineNum">     819</span>              : </span>
<span id="L820"><span class="lineNum">     820</span>              : #if _GTHREAD_USE_MUTEX_TIMEDLOCK</span>
<span id="L821"><span class="lineNum">     821</span>              : static inline int</span>
<span id="L822"><span class="lineNum">     822</span>              : __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,</span>
<span id="L823"><span class="lineNum">     823</span>              :                                      const __gthread_time_t *__abs_timeout)</span>
<span id="L824"><span class="lineNum">     824</span>              : {</span>
<span id="L825"><span class="lineNum">     825</span>              :   return __gthread_mutex_timedlock (__mutex, __abs_timeout);</span>
<span id="L826"><span class="lineNum">     826</span>              : }</span>
<span id="L827"><span class="lineNum">     827</span>              : #endif</span>
<span id="L828"><span class="lineNum">     828</span>              : </span>
<span id="L829"><span class="lineNum">     829</span>              : static inline int</span>
<span id="L830"><span class="lineNum">     830</span>              : __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)</span>
<span id="L831"><span class="lineNum">     831</span>              : {</span>
<span id="L832"><span class="lineNum">     832</span>              :   return __gthread_mutex_unlock (__mutex);</span>
<span id="L833"><span class="lineNum">     833</span>              : }</span>
<span id="L834"><span class="lineNum">     834</span>              : </span>
<span id="L835"><span class="lineNum">     835</span>              : static inline int</span>
<span id="L836"><span class="lineNum">     836</span>              : __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)</span>
<span id="L837"><span class="lineNum">     837</span>              : {</span>
<span id="L838"><span class="lineNum">     838</span>              :   return __gthread_mutex_destroy (__mutex);</span>
<span id="L839"><span class="lineNum">     839</span>              : }</span>
<span id="L840"><span class="lineNum">     840</span>              : </span>
<span id="L841"><span class="lineNum">     841</span>              : #ifdef _GTHREAD_USE_COND_INIT_FUNC</span>
<span id="L842"><span class="lineNum">     842</span>              : static inline void</span>
<span id="L843"><span class="lineNum">     843</span>              : __gthread_cond_init_function (__gthread_cond_t *__cond)</span>
<span id="L844"><span class="lineNum">     844</span>              : {</span>
<span id="L845"><span class="lineNum">     845</span>              :   if (__gthread_active_p ())</span>
<span id="L846"><span class="lineNum">     846</span>              :     __gthrw_(pthread_cond_init) (__cond, NULL);</span>
<span id="L847"><span class="lineNum">     847</span>              : }</span>
<span id="L848"><span class="lineNum">     848</span>              : #endif</span>
<span id="L849"><span class="lineNum">     849</span>              : </span>
<span id="L850"><span class="lineNum">     850</span>              : static inline int</span>
<span id="L851"><span class="lineNum">     851</span>              : __gthread_cond_broadcast (__gthread_cond_t *__cond)</span>
<span id="L852"><span class="lineNum">     852</span>              : {</span>
<span id="L853"><span class="lineNum">     853</span>              :   return __gthrw_(pthread_cond_broadcast) (__cond);</span>
<span id="L854"><span class="lineNum">     854</span>              : }</span>
<span id="L855"><span class="lineNum">     855</span>              : </span>
<span id="L856"><span class="lineNum">     856</span>              : static inline int</span>
<span id="L857"><span class="lineNum">     857</span>              : __gthread_cond_signal (__gthread_cond_t *__cond)</span>
<span id="L858"><span class="lineNum">     858</span>              : {</span>
<span id="L859"><span class="lineNum">     859</span>              :   return __gthrw_(pthread_cond_signal) (__cond);</span>
<span id="L860"><span class="lineNum">     860</span>              : }</span>
<span id="L861"><span class="lineNum">     861</span>              : </span>
<span id="L862"><span class="lineNum">     862</span>              : static inline int</span>
<span id="L863"><span class="lineNum">     863</span>              : __gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)</span>
<span id="L864"><span class="lineNum">     864</span>              : {</span>
<span id="L865"><span class="lineNum">     865</span>              :   return __gthrw_(pthread_cond_wait) (__cond, __mutex);</span>
<span id="L866"><span class="lineNum">     866</span>              : }</span>
<span id="L867"><span class="lineNum">     867</span>              : </span>
<span id="L868"><span class="lineNum">     868</span>              : static inline int</span>
<span id="L869"><span class="lineNum">     869</span>              : __gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,</span>
<span id="L870"><span class="lineNum">     870</span>              :                           const __gthread_time_t *__abs_timeout)</span>
<span id="L871"><span class="lineNum">     871</span>              : {</span>
<span id="L872"><span class="lineNum">     872</span>              :   return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);</span>
<span id="L873"><span class="lineNum">     873</span>              : }</span>
<span id="L874"><span class="lineNum">     874</span>              : </span>
<span id="L875"><span class="lineNum">     875</span>              : static inline int</span>
<span id="L876"><span class="lineNum">     876</span>              : __gthread_cond_wait_recursive (__gthread_cond_t *__cond,</span>
<span id="L877"><span class="lineNum">     877</span>              :                                __gthread_recursive_mutex_t *__mutex)</span>
<span id="L878"><span class="lineNum">     878</span>              : {</span>
<span id="L879"><span class="lineNum">     879</span>              :   return __gthread_cond_wait (__cond, __mutex);</span>
<span id="L880"><span class="lineNum">     880</span>              : }</span>
<span id="L881"><span class="lineNum">     881</span>              : </span>
<span id="L882"><span class="lineNum">     882</span>              : static inline int</span>
<span id="L883"><span class="lineNum">     883</span>              : __gthread_cond_destroy (__gthread_cond_t* __cond)</span>
<span id="L884"><span class="lineNum">     884</span>              : {</span>
<span id="L885"><span class="lineNum">     885</span>              :   return __gthrw_(pthread_cond_destroy) (__cond);</span>
<span id="L886"><span class="lineNum">     886</span>              : }</span>
<span id="L887"><span class="lineNum">     887</span>              : </span>
<span id="L888"><span class="lineNum">     888</span>              : #endif /* _LIBOBJC */</span>
<span id="L889"><span class="lineNum">     889</span>              : </span>
<span id="L890"><span class="lineNum">     890</span>              : #endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */</span>
        </pre>
              </td>
            </tr>
          </table>
          <br>

          <table width="100%" border=0 cellspacing=0 cellpadding=0>
            <tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
            <tr><td class="versionInfo">Generated by: <a href="https://github.com//linux-test-project/lcov" target="_parent">LCOV version 2.0-1</a></td></tr>
          </table>
          <br>

</body>
</html>
